home *** CD-ROM | disk | FTP | other *** search
- #!/usr/local/bin/perl
- #
- # merge the Image text files.
- #
- # Eli - 4/24/98
- #
- # Copyrights @ Possible Worlds Ltd. 1998
- #
-
- use Cwd;
- use English;
-
- $mergeName = "imgTxt.txt";
- $currentDir = cwd;
- open (OUTFILE, ">$mergeName");
- opendir(CURDIR, $currentDir) or die "can't open $dirname\n";
- while ($curFile = readdir(CURDIR)) {
- if ($curFile =~ /TMPIM\d.TXT/i) {
- print "--------- $curFile-----------\n";
- open (FILEIN, "<$curFile") or die "can't open file\n";
- while (<FILEIN>) {
- $current_line = $_;
- ($itemNum, $picText) = $current_line =~ /^(\d+),(\"[^\"]*\")/;
- if ($itemNum && $picText) {
- $picText =~ s/^\"(.*)\"$/\1/;
- $picItem{$itemNum} = $picText;
- } # if
- } # while
- close (FILEIN);
- } # if the file is one that need processing
- } # while
- foreach $itemNum (sort {$a <=> $b} (keys (%picItem))) {
- print OUTFILE "$itemNum|$picItem{$itemNum}\n";
- }
- close (OUTFILE);
-